<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.8"/>
<title>embedme: Utils类 参考</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">embedme
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.8 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>首页</span></a></li>
      <li class="current"><a href="annotated.html"><span>类</span></a></li>
      <li><a href="files.html"><span>文件</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>类列表</span></a></li>
      <li><a href="classes.html"><span>类索引</span></a></li>
      <li><a href="hierarchy.html"><span>类继承关系</span></a></li>
      <li><a href="functions.html"><span>类成员</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-static-methods">静态 Public 成员函数</a> &#124;
<a href="class_utils-members.html">所有成员列表</a>  </div>
  <div class="headertitle">
<div class="title">Utils类 参考</div>  </div>
</div><!--header-->
<div class="contents">

<p>工具类  
 <a href="class_utils.html#details">更多...</a></p>

<p><code>#include &lt;<a class="el" href="_utils_8h_source.html">Utils.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
静态 Public 成员函数</h2></td></tr>
<tr class="memitem:a10702828999dc39a4076b097f61b0046"><td class="memItemLeft" align="right" valign="top">static sint32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_utils.html#a10702828999dc39a4076b097f61b0046">random</a> (sint32 max)</td></tr>
<tr class="memdesc:a10702828999dc39a4076b097f61b0046"><td class="mdescLeft">&#160;</td><td class="mdescRight">生成一个随机数  <a href="#a10702828999dc39a4076b097f61b0046">更多...</a><br /></td></tr>
<tr class="separator:a10702828999dc39a4076b097f61b0046"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5f7497f1f2cfcd14353711df1a4df6d9"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_utils.html#a5f7497f1f2cfcd14353711df1a4df6d9">isBigEndian</a> (void)</td></tr>
<tr class="memdesc:a5f7497f1f2cfcd14353711df1a4df6d9"><td class="mdescLeft">&#160;</td><td class="mdescRight">判断主机是大端还是小端字节序  <a href="#a5f7497f1f2cfcd14353711df1a4df6d9">更多...</a><br /></td></tr>
<tr class="separator:a5f7497f1f2cfcd14353711df1a4df6d9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac24e02b86c0d0633bf06049be63a1a3a"><td class="memItemLeft" align="right" valign="top">static uint16&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_utils.html#ac24e02b86c0d0633bf06049be63a1a3a">host2LitEndian</a> (uint16 value)</td></tr>
<tr class="memdesc:ac24e02b86c0d0633bf06049be63a1a3a"><td class="mdescLeft">&#160;</td><td class="mdescRight">将数字转换成小端字节序  <a href="#ac24e02b86c0d0633bf06049be63a1a3a">更多...</a><br /></td></tr>
<tr class="separator:ac24e02b86c0d0633bf06049be63a1a3a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad34748eeb0095fc77a4fc45ddaa73b12"><td class="memItemLeft" align="right" valign="top">static uint32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_utils.html#ad34748eeb0095fc77a4fc45ddaa73b12">host2LitEndian</a> (uint32 value)</td></tr>
<tr class="memdesc:ad34748eeb0095fc77a4fc45ddaa73b12"><td class="mdescLeft">&#160;</td><td class="mdescRight">将数字转换成小端字节序  <a href="#ad34748eeb0095fc77a4fc45ddaa73b12">更多...</a><br /></td></tr>
<tr class="separator:ad34748eeb0095fc77a4fc45ddaa73b12"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6686f66b3fc90b7b7b3f082b98d85f9d"><td class="memItemLeft" align="right" valign="top">static uint16&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_utils.html#a6686f66b3fc90b7b7b3f082b98d85f9d">host2BigEndian</a> (uint16 value)</td></tr>
<tr class="memdesc:a6686f66b3fc90b7b7b3f082b98d85f9d"><td class="mdescLeft">&#160;</td><td class="mdescRight">将数字转换成大端字节序  <a href="#a6686f66b3fc90b7b7b3f082b98d85f9d">更多...</a><br /></td></tr>
<tr class="separator:a6686f66b3fc90b7b7b3f082b98d85f9d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a348631871c43eb7d9cbd2453f90da373"><td class="memItemLeft" align="right" valign="top">static uint32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_utils.html#a348631871c43eb7d9cbd2453f90da373">host2BigEndian</a> (uint32 value)</td></tr>
<tr class="memdesc:a348631871c43eb7d9cbd2453f90da373"><td class="mdescLeft">&#160;</td><td class="mdescRight">将数字转换成大端字节序  <a href="#a348631871c43eb7d9cbd2453f90da373">更多...</a><br /></td></tr>
<tr class="separator:a348631871c43eb7d9cbd2453f90da373"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad51d3336750b0453623b0e513db3ef6e"><td class="memItemLeft" align="right" valign="top">static string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_utils.html#ad51d3336750b0453623b0e513db3ef6e">unicodeOneToUtf8String</a> (uint32 unicode)</td></tr>
<tr class="memdesc:ad51d3336750b0453623b0e513db3ef6e"><td class="mdescLeft">&#160;</td><td class="mdescRight">unicode编码转换为utf8编码的字符串  <a href="#ad51d3336750b0453623b0e513db3ef6e">更多...</a><br /></td></tr>
<tr class="separator:ad51d3336750b0453623b0e513db3ef6e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7b4b5ca72dbe0af5a472e36c7cc37a27"><td class="memItemLeft" align="right" valign="top">static uint32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_utils.html#a7b4b5ca72dbe0af5a472e36c7cc37a27">utf8OneToUnicode</a> (const char *utf8code)</td></tr>
<tr class="memdesc:a7b4b5ca72dbe0af5a472e36c7cc37a27"><td class="mdescLeft">&#160;</td><td class="mdescRight">utf8编码转换为unicode编码的字符串  <a href="#a7b4b5ca72dbe0af5a472e36c7cc37a27">更多...</a><br /></td></tr>
<tr class="separator:a7b4b5ca72dbe0af5a472e36c7cc37a27"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3983b2a151262d06dfef4e7f0b9689d2"><td class="memItemLeft" align="right" valign="top">static string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_utils.html#a3983b2a151262d06dfef4e7f0b9689d2">findString</a> (const string &amp;source, const string &amp;start, const string &amp;end)</td></tr>
<tr class="memdesc:a3983b2a151262d06dfef4e7f0b9689d2"><td class="mdescLeft">&#160;</td><td class="mdescRight">查找start开始与end结束的字符串  <a href="#a3983b2a151262d06dfef4e7f0b9689d2">更多...</a><br /></td></tr>
<tr class="separator:a3983b2a151262d06dfef4e7f0b9689d2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac7aa2d138cfad5b8bc66a9911f8c45e1"><td class="memItemLeft" align="right" valign="top">static string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_utils.html#ac7aa2d138cfad5b8bc66a9911f8c45e1">findString</a> (const string &amp;source, const string &amp;pattern, const string &amp;before, const string &amp;after)</td></tr>
<tr class="memdesc:ac7aa2d138cfad5b8bc66a9911f8c45e1"><td class="mdescLeft">&#160;</td><td class="mdescRight">查找匹配字段  <a href="#ac7aa2d138cfad5b8bc66a9911f8c45e1">更多...</a><br /></td></tr>
<tr class="separator:ac7aa2d138cfad5b8bc66a9911f8c45e1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afc5f03d5f6c8d87a2d4d9340d942de32"><td class="memItemLeft" align="right" valign="top">static string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_utils.html#afc5f03d5f6c8d87a2d4d9340d942de32">trimBeginWith</a> (const string &amp;source, const string &amp;trimch)</td></tr>
<tr class="memdesc:afc5f03d5f6c8d87a2d4d9340d942de32"><td class="mdescLeft">&#160;</td><td class="mdescRight">从字符串头部去除trimch包含的字符,直至遇到非trimch字符为止  <a href="#afc5f03d5f6c8d87a2d4d9340d942de32">更多...</a><br /></td></tr>
<tr class="separator:afc5f03d5f6c8d87a2d4d9340d942de32"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2715e8eab11063806810ae7c16cb388a"><td class="memItemLeft" align="right" valign="top">static string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_utils.html#a2715e8eab11063806810ae7c16cb388a">trimEndingBlank</a> (const string &amp;source)</td></tr>
<tr class="memdesc:a2715e8eab11063806810ae7c16cb388a"><td class="mdescLeft">&#160;</td><td class="mdescRight">去除字符串首尾两端的不可见字符  <a href="#a2715e8eab11063806810ae7c16cb388a">更多...</a><br /></td></tr>
<tr class="separator:a2715e8eab11063806810ae7c16cb388a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4306306ce96eabe0ba24600277b0a138"><td class="memItemLeft" align="right" valign="top">static string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_utils.html#a4306306ce96eabe0ba24600277b0a138">trimAllBlank</a> (const string &amp;source)</td></tr>
<tr class="memdesc:a4306306ce96eabe0ba24600277b0a138"><td class="mdescLeft">&#160;</td><td class="mdescRight">去除字符串中所有不可见字符  <a href="#a4306306ce96eabe0ba24600277b0a138">更多...</a><br /></td></tr>
<tr class="separator:a4306306ce96eabe0ba24600277b0a138"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae6e078d5b8b8521b9f97756bb68986c6"><td class="memItemLeft" align="right" valign="top">static vector&lt; string &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_utils.html#ae6e078d5b8b8521b9f97756bb68986c6">cutString</a> (const string &amp;source, const string &amp;startFlag, const string &amp;stopFlag, const string &amp;cutFlag)</td></tr>
<tr class="memdesc:ae6e078d5b8b8521b9f97756bb68986c6"><td class="mdescLeft">&#160;</td><td class="mdescRight">分割字符串  <a href="#ae6e078d5b8b8521b9f97756bb68986c6">更多...</a><br /></td></tr>
<tr class="separator:ae6e078d5b8b8521b9f97756bb68986c6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a691ec4b7f5042369933173d4a0491312"><td class="memItemLeft" align="right" valign="top">static sint32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_utils.html#a691ec4b7f5042369933173d4a0491312">stringPatternCount</a> (const string &amp;source, const string &amp;pattern)</td></tr>
<tr class="memdesc:a691ec4b7f5042369933173d4a0491312"><td class="mdescLeft">&#160;</td><td class="mdescRight">获取匹配次数  <a href="#a691ec4b7f5042369933173d4a0491312">更多...</a><br /></td></tr>
<tr class="separator:a691ec4b7f5042369933173d4a0491312"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8e240650bfb615f8e33007f9098a1049"><td class="memItemLeft" align="right" valign="top">static sint8&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_utils.html#a8e240650bfb615f8e33007f9098a1049">ascii2digital</a> (char ch)</td></tr>
<tr class="memdesc:a8e240650bfb615f8e33007f9098a1049"><td class="mdescLeft">&#160;</td><td class="mdescRight">ASCII码转换为数字  <a href="#a8e240650bfb615f8e33007f9098a1049">更多...</a><br /></td></tr>
<tr class="separator:a8e240650bfb615f8e33007f9098a1049"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae35e73ebd15f0497c3e1963932c0e605"><td class="memItemLeft" align="right" valign="top">static char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_utils.html#ae35e73ebd15f0497c3e1963932c0e605">digital2ascii</a> (uint8 val)</td></tr>
<tr class="memdesc:ae35e73ebd15f0497c3e1963932c0e605"><td class="mdescLeft">&#160;</td><td class="mdescRight">数字转换为ASCII码  <a href="#ae35e73ebd15f0497c3e1963932c0e605">更多...</a><br /></td></tr>
<tr class="separator:ae35e73ebd15f0497c3e1963932c0e605"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5c158c6bcc283c1fe8169e83b9bf9f12"><td class="memItemLeft" align="right" valign="top">static sint32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_utils.html#a5c158c6bcc283c1fe8169e83b9bf9f12">string2code</a> (const string codestr, uint8 *codebuf, sint32 len)</td></tr>
<tr class="memdesc:a5c158c6bcc283c1fe8169e83b9bf9f12"><td class="mdescLeft">&#160;</td><td class="mdescRight">字符串转为编码  <a href="#a5c158c6bcc283c1fe8169e83b9bf9f12">更多...</a><br /></td></tr>
<tr class="separator:a5c158c6bcc283c1fe8169e83b9bf9f12"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9a5be5ae3aa534220fff48613d1b2388"><td class="memItemLeft" align="right" valign="top">static string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_utils.html#a9a5be5ae3aa534220fff48613d1b2388">code2string</a> (const uint8 *codebuf, sint32 len)</td></tr>
<tr class="memdesc:a9a5be5ae3aa534220fff48613d1b2388"><td class="mdescLeft">&#160;</td><td class="mdescRight">编码转为字符串  <a href="#a9a5be5ae3aa534220fff48613d1b2388">更多...</a><br /></td></tr>
<tr class="separator:a9a5be5ae3aa534220fff48613d1b2388"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac1e63a558c84b5f61c65680b54da1b52"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac1e63a558c84b5f61c65680b54da1b52"></a>
static uint16&#160;</td><td class="memItemRight" valign="bottom"><b>bitsReverse</b> (uint16 value, uint8 bits)</td></tr>
<tr class="separator:ac1e63a558c84b5f61c65680b54da1b52"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a67a0e2fb412eea002ca924317649f07e"><td class="memItemLeft" align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_utils.html#a67a0e2fb412eea002ca924317649f07e">eval</a> (const char *expression)</td></tr>
<tr class="memdesc:a67a0e2fb412eea002ca924317649f07e"><td class="mdescLeft">&#160;</td><td class="mdescRight">算术计算函数  <a href="#a67a0e2fb412eea002ca924317649f07e">更多...</a><br /></td></tr>
<tr class="separator:a67a0e2fb412eea002ca924317649f07e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock"><p>工具类 </p>
</div><h2 class="groupheader">成员函数说明</h2>
<a class="anchor" id="a8e240650bfb615f8e33007f9098a1049"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">sint8 Utils::ascii2digital </td>
          <td>(</td>
          <td class="paramtype">char&#160;</td>
          <td class="paramname"><em>ch</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>ASCII码转换为数字 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">ch</td><td>ASCII码字符 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>ch对应的数字 </dd></dl>
<dl class="section note"><dt>注解</dt><dd>字符'0'~'9'转换后为数字0~9,'a'~'f'或'A'~'F'转换后为10~16,其余返回值为-1 </dd></dl>

</div>
</div>
<a class="anchor" id="a9a5be5ae3aa534220fff48613d1b2388"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::string Utils::code2string </td>
          <td>(</td>
          <td class="paramtype">const uint8 *&#160;</td>
          <td class="paramname"><em>codebuf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">sint32&#160;</td>
          <td class="paramname"><em>len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>编码转为字符串 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">codebuf</td><td>待转换的编码缓存 </td></tr>
    <tr><td class="paramname">len</td><td>缓存大小 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>成功返回转换后的字符串,失败返回空字符串 </dd></dl>
<dl class="section note"><dt>注解</dt><dd>[0x00][0x41][0x00][0x1F]==&gt;"0041001F" </dd></dl>

</div>
</div>
<a class="anchor" id="ae6e078d5b8b8521b9f97756bb68986c6"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">vector&lt; string &gt; Utils::cutString </td>
          <td>(</td>
          <td class="paramtype">const string &amp;&#160;</td>
          <td class="paramname"><em>source</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const string &amp;&#160;</td>
          <td class="paramname"><em>startFlag</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const string &amp;&#160;</td>
          <td class="paramname"><em>endFlag</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const string &amp;&#160;</td>
          <td class="paramname"><em>cutFlag</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>分割字符串 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">source</td><td>源字串 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回分割后的字串数组 </dd></dl>
<dl class="section note"><dt>注解</dt><dd>分割从startFlag后到endFlag之前的字串,分割符为cutFlag </dd></dl>

</div>
</div>
<a class="anchor" id="ae35e73ebd15f0497c3e1963932c0e605"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">char Utils::digital2ascii </td>
          <td>(</td>
          <td class="paramtype">uint8&#160;</td>
          <td class="paramname"><em>val</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>数字转换为ASCII码 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">val</td><td>数字 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>数字对应的ASCII码字符 </dd></dl>
<dl class="section note"><dt>注解</dt><dd>数字0~9转成字符'0'~'9',数字10~16转成'A'~'F',其余返回值为0,为字符串结束符 </dd></dl>

</div>
</div>
<a class="anchor" id="a67a0e2fb412eea002ca924317649f07e"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int Utils::eval </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>expression</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>算术计算函数 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">expression</td><td>算术表达式,支持整数的加减乘除及括号 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回计算结果 </dd></dl>
<dl class="section note"><dt>注解</dt><dd></dd></dl>

</div>
</div>
<a class="anchor" id="a3983b2a151262d06dfef4e7f0b9689d2"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::string Utils::findString </td>
          <td>(</td>
          <td class="paramtype">const string &amp;&#160;</td>
          <td class="paramname"><em>source</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const string &amp;&#160;</td>
          <td class="paramname"><em>start</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const string &amp;&#160;</td>
          <td class="paramname"><em>end</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>查找start开始与end结束的字符串 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">source</td><td>源字串 </td></tr>
    <tr><td class="paramname">start</td><td>开始字串 </td></tr>
    <tr><td class="paramname">end</td><td>结束字串 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回找到的字符串 </dd></dl>
<dl class="section note"><dt>注解</dt><dd>none </dd></dl>

</div>
</div>
<a class="anchor" id="ac7aa2d138cfad5b8bc66a9911f8c45e1"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">string Utils::findString </td>
          <td>(</td>
          <td class="paramtype">const string &amp;&#160;</td>
          <td class="paramname"><em>source</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const string &amp;&#160;</td>
          <td class="paramname"><em>pattern</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const string &amp;&#160;</td>
          <td class="paramname"><em>before</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const string &amp;&#160;</td>
          <td class="paramname"><em>after</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>查找匹配字段 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">source</td><td>源字串 </td></tr>
    <tr><td class="paramname">pattern</td><td>匹配字串 </td></tr>
    <tr><td class="paramname">before</td><td>匹配字串之前的字串 </td></tr>
    <tr><td class="paramname">after</td><td>匹配字串之后的字串 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回找到的字符串 </dd></dl>
<dl class="section note"><dt>注解</dt><dd>none </dd></dl>

</div>
</div>
<a class="anchor" id="a6686f66b3fc90b7b7b3f082b98d85f9d"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">uint16 Utils::host2BigEndian </td>
          <td>(</td>
          <td class="paramtype">uint16&#160;</td>
          <td class="paramname"><em>value</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>将数字转换成大端字节序 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">value</td><td>16位宽的数字 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回转换后的数字 </dd></dl>
<dl class="section note"><dt>注解</dt><dd>none </dd></dl>

</div>
</div>
<a class="anchor" id="a348631871c43eb7d9cbd2453f90da373"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">uint32 Utils::host2BigEndian </td>
          <td>(</td>
          <td class="paramtype">uint32&#160;</td>
          <td class="paramname"><em>value</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>将数字转换成大端字节序 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">value</td><td>32位宽的数字 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回转换后的数字 </dd></dl>
<dl class="section note"><dt>注解</dt><dd>none </dd></dl>

</div>
</div>
<a class="anchor" id="ac24e02b86c0d0633bf06049be63a1a3a"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">uint16 Utils::host2LitEndian </td>
          <td>(</td>
          <td class="paramtype">uint16&#160;</td>
          <td class="paramname"><em>value</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>将数字转换成小端字节序 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">value</td><td>16位宽的数字 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回转换后的数字 </dd></dl>
<dl class="section note"><dt>注解</dt><dd>none </dd></dl>

</div>
</div>
<a class="anchor" id="ad34748eeb0095fc77a4fc45ddaa73b12"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">uint32 Utils::host2LitEndian </td>
          <td>(</td>
          <td class="paramtype">uint32&#160;</td>
          <td class="paramname"><em>value</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>将数字转换成小端字节序 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">value</td><td>32位宽的数字 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回转换后的数字 </dd></dl>
<dl class="section note"><dt>注解</dt><dd>none </dd></dl>

</div>
</div>
<a class="anchor" id="a5f7497f1f2cfcd14353711df1a4df6d9"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool Utils::isBigEndian </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>判断主机是大端还是小端字节序 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">void</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>大端字节序返回true,小端字节序返回false </dd></dl>
<dl class="section note"><dt>注解</dt><dd>小端模式是数字的低位在低地址,大端模式是高位在低地址 0x1234 &mdash;数值 [0x34][0x12]&mdash;小端模式中内存存储(计算机逻辑,低地址放低位) [0x12][0x34]&mdash;大端模式中内存存储(更符合人类思维习惯) </dd></dl>

</div>
</div>
<a class="anchor" id="a10702828999dc39a4076b097f61b0046"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">sint32 Utils::random </td>
          <td>(</td>
          <td class="paramtype">sint32&#160;</td>
          <td class="paramname"><em>max</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>生成一个随机数 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">max</td><td>最大取值 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回随机数 </dd></dl>
<dl class="section note"><dt>注解</dt><dd>生成一个0~max之间的随机数 </dd></dl>

</div>
</div>
<a class="anchor" id="a5c158c6bcc283c1fe8169e83b9bf9f12"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">sint32 Utils::string2code </td>
          <td>(</td>
          <td class="paramtype">const string&#160;</td>
          <td class="paramname"><em>codestr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8 *&#160;</td>
          <td class="paramname"><em>codebuf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">sint32&#160;</td>
          <td class="paramname"><em>len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>字符串转为编码 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">codestr</td><td>待转换字符创 </td></tr>
    <tr><td class="paramname">codebuf</td><td>转换好的编码缓存 </td></tr>
    <tr><td class="paramname">len</td><td>缓存大小 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>成功返回code的长度,失败返回STATUS_ERROR </dd></dl>
<dl class="section note"><dt>注解</dt><dd>"0041001F" ==&gt;[0x00][0x41][0x00][0x1F] </dd></dl>

</div>
</div>
<a class="anchor" id="a691ec4b7f5042369933173d4a0491312"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">sint32 Utils::stringPatternCount </td>
          <td>(</td>
          <td class="paramtype">const string &amp;&#160;</td>
          <td class="paramname"><em>source</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const string &amp;&#160;</td>
          <td class="paramname"><em>pattern</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>获取匹配次数 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">source</td><td>源字串 </td></tr>
    <tr><td class="paramname">pattern</td><td>匹配字串 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回匹配次数 </dd></dl>
<dl class="section note"><dt>注解</dt><dd>none </dd></dl>

</div>
</div>
<a class="anchor" id="a4306306ce96eabe0ba24600277b0a138"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::string Utils::trimAllBlank </td>
          <td>(</td>
          <td class="paramtype">const string &amp;&#160;</td>
          <td class="paramname"><em>source</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>去除字符串中所有不可见字符 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">source</td><td>源字串 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回trim后得到的字符串 </dd></dl>
<dl class="section note"><dt>注解</dt><dd>none </dd></dl>

</div>
</div>
<a class="anchor" id="afc5f03d5f6c8d87a2d4d9340d942de32"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">string Utils::trimBeginWith </td>
          <td>(</td>
          <td class="paramtype">const string &amp;&#160;</td>
          <td class="paramname"><em>source</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const string &amp;&#160;</td>
          <td class="paramname"><em>trimch</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>从字符串头部去除trimch包含的字符,直至遇到非trimch字符为止 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">source</td><td>源字串 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回trim后得到的字符串 </dd></dl>
<dl class="section note"><dt>注解</dt><dd>例:result = trimBeginWith(" 0001234","0 ");//result="1234" </dd></dl>

</div>
</div>
<a class="anchor" id="a2715e8eab11063806810ae7c16cb388a"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::string Utils::trimEndingBlank </td>
          <td>(</td>
          <td class="paramtype">const string &amp;&#160;</td>
          <td class="paramname"><em>source</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>去除字符串首尾两端的不可见字符 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">source</td><td>源字串 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回trim后得到的字符串 </dd></dl>
<dl class="section note"><dt>注解</dt><dd>none </dd></dl>

</div>
</div>
<a class="anchor" id="ad51d3336750b0453623b0e513db3ef6e"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::string Utils::unicodeOneToUtf8String </td>
          <td>(</td>
          <td class="paramtype">uint32&#160;</td>
          <td class="paramname"><em>unicode</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>unicode编码转换为utf8编码的字符串 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">unicode</td><td>字符编码 </td></tr>
    <tr><td class="paramname">utfcode</td><td>转换后的UTF8编码缓冲区(最少6字节) </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回转换后的字符,转换失败时返回空字符 </dd></dl>
<dl class="section note"><dt>注解</dt><dd>none </dd></dl>

</div>
</div>
<a class="anchor" id="a7b4b5ca72dbe0af5a472e36c7cc37a27"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">uint32 Utils::utf8OneToUnicode </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>utf8code</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>utf8编码转换为unicode编码的字符串 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">utfcode</td><td>UTF8编码(1~6字节) </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>成功返回unicode编码,失败返回0 </dd></dl>
<dl class="section note"><dt>注解</dt><dd>none </dd></dl>

</div>
</div>
<hr/>该类的文档由以下文件生成:<ul>
<li>libemb/inc/<a class="el" href="_utils_8h_source.html">Utils.h</a></li>
<li>libemb/src/Utils.cpp</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
生成于 2016年 七月 7日 星期四 19:49:39 , 为 embedme使用  &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.8
</small></address>
</body>
</html>
